package com.duotai;

public class Wangxiaoer extends Wanger {
    @Override
    public void write() {
        System.out.println("我是儿子");
    }

    public static void main(String[] args) {
        // 父类引用指向子类对象
        Wanger[]  wangers = {new Wanger(), new Wangxiaoer()};

        for (Wanger wanger : wangers) {
            wanger.write();
        }
    }
}